<template>
  <div>
    <el-col :span="24">

      <el-row>
        <div align="center"><h1>选择用户解密</h1></div>
      </el-row>

      <el-row>
        <el-col :span="2"><div class="grid-content">&nbsp;</div></el-col>
        <el-col :span="4"><div class="grid-content">
          <h2>1.密码信息</h2></div>
        </el-col>
      </el-row>

<el-row>
  <el-col :span="2"><div class="grid-content">&nbsp;</div></el-col>
  <el-col :span="20"><div class="grid-content">
  <h4>选择用户:</h4></div>
  <el-select v-model="value" style="width:100%" filterable placeholder="请选择">
    <el-option
      v-for="item in options"
      :key="item.value"
      :label="item.label"
      :value="item.value">
    </el-option>
  </el-select>

  </el-col>
</el-row>


      <el-row>
        <el-col :span="2"><div class="grid-content">&nbsp;</div></el-col>
        <el-col :span="20"><div class="grid-content">
                             <h4>密文:</h4></div>
          <el-input v-model="image"   type="textarea"  rows="2" placeholder="请输入内容" />
          <br><br>
          <el-button type="primary" style="width:20%" icon="el-icon-top" @click="sumbit">提交解密</el-button>
          <br><br>

          <div v-show="play" v-highlight>
            <pre><code class="javascript" v-html="message2" /></pre>
          </div>

        </el-col>
      </el-row>



    </el-col>
  </div>

</template>

<script>
import { deciphering,getuser } from '@/api/query'
export default {
  data() {
    return {
      options: [{
        value: '1',
        label: '数据加载中请稍后'
      }],
      value: '',
      image: '',
      message2: '',
      play: false,
    }
  },
  created() {
    this.getuser()
  },
  methods: {
    getuser() {
      getuser().then(response => {
        // console.log(response.data)
        this.options = response.data
      })
    },
    sumbit() {
      this.play = true
      console.log(this.value)
      console.log(this.image)
      deciphering({ 'name': this.value, 'text': this.image }).then(response => {
        console.log(response.data)
        this.message2 = response.data
        // this.value= response.data.podname
      })
    },
  }
}
</script>

<style scoped>
.el-col {
  min-height: 1px
}
</style>
